package utils;

import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;

/**
 * Created by iss on 17/10/17.
 */
public class FileReader2 {

    public static void main(String[] args) throws IOException {

        File file = new File("/Users/iss/mobiles-chengdu.txt");
        java.io.FileReader fr = new java.io.FileReader(file);

        BufferedReader br = new BufferedReader(fr);

        String str = br.readLine();
        StringBuilder sb = new StringBuilder("");
        int total = 0;

        while (str != null) {
            try {
                sb.append(str).append(",");
                total++;
            } catch (Exception e) {
                e.printStackTrace();
            }

            str = br.readLine();
        }

        br.close();
        fr.close();

        System.out.println("mobiles = " + sb);
        System.out.println("total = " + total);

    }

}
